<?php
/********************************************************************************
 * File: recent.php
 * Desc: Recent page shows all photos ordered by date descending with 54 photos
 *       shown on a page.
 * Args: page - int optional.  
 *          The page number to show.  If none, show the most first page with the
 *          most recent 54 photos.
 * 
 * Change   Date        By          Description
 * 1        05/13/2007  mcarruth    Created
 ********************************************************************************/

if (!$_GET['page']) {
   $page = "1";
}
else {
   $page = $_GET['page'];
}
 
require_once("inc/header.inc");
echo "<script type='text/javascript' src='js/mootools.js'></script>\n";
echo "<script type='text/javascript' src='js/slimbox.js'></script>\n";
echo "<link rel='stylesheet' href='css/slimbox.css' type='text/css' media='screen' />\n";

$prev = $page - 1;
$next = $page + 1;
$photos = $f->photos_search(array("user_id"=>$config_flickrUserId, "extras"=>"original_format,date_taken", "per_page"=>"54", "page"=>$page));

echo "<div id='page_header'>\n";
echo    "<span id='page_title'>Recent</span>\n";
echo    "<span id='page_nav'>\n";
echo       "<a href='recent.php?page=" . $prev . "'>prev </a>\n";
echo       "<a href='recent.php?page=" . $next . "'>next</a>\n";
echo    "</span>\n";
echo "</div>\n";
echo "<div id='page'>\n";

foreach ($photos['photo'] as $photo) {
   $date = getdate(strtotime($photo['datetaken']));
   $datestr = $date['month'] . " " . $date['mday'] . ", " . $date['year'];
   echo "<a href='" . $f->buildPhotoURL($photo, "Medium") . "' rel='lightbox[recent]' title='" . $photo['title'] . " | " . $datestr . "' name='" . $photo['id'] . "'>\n";
   echo "   <img class='thumbnail' src='" . $f->buildPhotoURL($photo, "Square") . "' title='" . $photo['title'] . " | " . $datestr . "' alt='" . $photo['title']  . "' />\n";
   echo "</a>\n";   
}

echo    "<div id='page_meta'></div>\n";
echo "</div>\n";

require_once("inc/footer.inc"); 

?>
